home *** CD-ROM | disk | FTP | other *** search
/ ftp.qualcomm.com / 2014.06.ftp.qualcomm.com.tar / ftp.qualcomm.com / eudora / developers / emsapi / carbon_emsapi.sit.hqx / Macintosh API Support / emsapi-mac.h < prev    next >
Text File  |  2001-03-08  |  47KB  |  1,003 lines

  1.  /* ======================================================================
  2.  
  3.     C header for EMSAPI version 6
  4.     Copyright 1996, 1997, 1998, 1999, 2000 QUALCOMM Inc.
  5.     Send comments and questions to <emsapi-info@qualcomm.com>
  6.  
  7.     Filename: emsapi-mac.h
  8.  
  9.     USE THIS FILE TO BUILD YOUR MACINTOSH TRANSLATOR COMPONENT. 
  10.  
  11. */
  12.  
  13. #if TARGET_API_MAC_CARBON
  14. //    I don't want to take out all of the GENERATINGCFMs right now
  15. #undef GENERATINGCFM
  16. #define GENERATINGCFM 0
  17. #endif
  18.  
  19. #ifndef EMSAPI_MAC_H_INCLUDED
  20. #define EMSAPI_MAC_H_INCLUDED
  21.  
  22. /* ========== CONSTANTS AND RETURN VALUES ================================ */
  23.  
  24. /* ----- Translator return codes --- store as a long --------------------- */ 
  25. #define EMSR_OK              (0L)     /* The translation operation succeeded */
  26. #define EMSR_UNKNOWN_FAIL    (1L)     /* Failed for unspecified reason */
  27. #define EMSR_CANT_TRANS      (2L)     /* Don't know how to translate this */
  28. #define EMSR_INVALID_TRANS   (3L)     /* The translator ID given was invalid */
  29. #define EMSR_NO_ENTRY        (4L)     /* The value requested doesn't exist */
  30. #define EMSR_NO_INPUT_FILE   (5L)     /* Couldn't find input file */
  31. #define EMSR_CANT_CREATE     (6L)     /* Couldn't create the output file */
  32. #define EMSR_TRANS_FAILED    (7L)     /* The translation failed. */
  33. #define EMSR_INVALID         (8L)     /* Invalid argument(s) given */
  34. #define EMSR_NOT_NOW         (9L)     /* Translation can be done not in current
  35.                                          context */
  36. #define EMSR_NOW            (10L)     /* Indicates translation can be performed
  37.                                          right away */
  38. #define EMSR_ABORTED        (11L)     /* Translation was aborted by user */
  39. #define EMSR_DATA_UNCHANGED (12L)     /* Trans OK, data was not changed */
  40. #define EMSR_NOT_INTERESTED (13L)     /* V4! Peanut Not now, but not in DISPLAY? */
  41. #define EMSR_USER_CANCELLED    (14L)            /* V4 User cancelled */
  42.  
  43.  
  44. /* ----- Translator types --- store as a long ---------------------------- */ 
  45. #define EMST_NO_TYPE          (-1L)
  46. #define EMST_LANGUAGE         (0x10L)
  47. #define EMST_TEXT_FORMAT      (0x20L)
  48. #define EMST_GRAPHIC_FORMAT   (0x30L)
  49. #define EMST_COMPRESSION      (0x40L)
  50. #define EMST_COALESCED        (0x50L)
  51. #define EMST_SIGNATURE        (0x60L)
  52. #define EMST_PREPROCESS       (0x70L)
  53. #define EMST_CERT_MANAGEMENT  (0x80L)
  54. #define EMST_IMPORTER          (0x90L)
  55.  
  56.  
  57. /* ----- Translator info flags and contexts --- store as a long ---------- */
  58. /* Used both as bit flags and as constants */
  59. #define EMSF_ON_ARRIVAL      (0x0001L) /* Call on message arrivial */
  60. #define EMSF_ON_DISPLAY      (0x0002L) /* Call when user views message */
  61. #define EMSF_ON_REQUEST      (0x0004L) /* Call when selected from menu */
  62. #define EMSF_Q4_COMPLETION   (0x0008L) /* Queue and call on complete 
  63.                                           composition of a message */
  64. #define EMSF_Q4_TRANSMISSION (0x0010L) /* Queue and call on transmission 
  65.                                           of a message */
  66. #define EMSF_WHOLE_MESSAGE   (0x0200L) /* Works on the whole message even if
  67.                                          it has sub-parts. (e.g. signature) */
  68. #define EMSF_REQUIRES_MIME   (0x0400L) /* Items presented for translation
  69.                                           should be MIME entities with
  70.                                           canonical end of line representation,
  71.                                           proper transfer encoding
  72.                                           and headers */
  73. #define EMSF_GENERATES_MIME  (0x0800L) /* Data produced will be MIME format */
  74. #define EMSF_ALL_HEADERS     (0x1000L) /* All headers in & out of trans when
  75.                                           MIME format is used */
  76. #define EMSF_BASIC_HEADERS   (0x2000L) /* Just the basic to, from, subject, cc,b
  77.                       cc headers */
  78.  
  79. #define EMSF_DEFAULT_Q_ON    (0x4000L)    /* Causes queued translation to be on 
  80.                                           for a new message by default */
  81. #define EMSF_TOOLBAR_PRESENCE (0x8000L)    /* Appear on the Toolbar */
  82. #define EMSF_ALL_TEXT        (0x10000L) /* All text instead of current selection for ON_REQUEST */
  83. #define EMSF_DONTSAVE    (0x80000000)        /* Mark messages as unchanged so user 
  84.                     is not prompted for save.  Add to any 
  85.                     return code */
  86.  
  87.  
  88. /* ----- The version of the API defined by this include file ------------- */
  89. #define EMS_VERSION          (6)       /* Used in plugin init */
  90. #define EMS_COMPONENT        'EuTL'    /* Macintosh component type */
  91.  
  92.  
  93. /* ----- Translator and translator type specific return codes ------------ */
  94. #define EMSC_SIGOK           (1L)      /* A signature verification succeeded */
  95. #define EMSC_SIGBAD          (2L)      /* A signature verification failed */
  96. #define EMSC_SIGUNKNOWN      (3L)      /* Result of verification unknown */
  97.  
  98. /* ----- V4! Peanut IDLE Events  ------------ */
  99. /* Note that it is possible to have both EMIDLE_UI_ALLOWED and EMIDLE_QUICK set, in that
  100.  * case the plug-in should only do a UI operation if it's absolutely essential (i.e., errors only).
  101.  * If EMIDLE_UI_ALLOWED is NOT set, then using the progress
  102.  */
  103.  
  104. /* ----- Values for ems_idle flags -------------------------- */
  105. #define EMIDLE_UI_ALLOWED        (1L)      /* Interactions with user are allowed */
  106. #define EMIDLE_QUICK                (2L)      /* Now is NOT the time to do something lengthy */
  107. #define EMIDLE_OFFLINE            (4L)      /* Eudora is in "offline" mode */
  108. #define EMIDLE_PRE_SEND            (8L)          /* Eudora is about to send mail */
  109. #define EMIDLE_TRANSFERRING    (16L)          /* Eudora is transferring mail */
  110.  
  111.  
  112.  
  113. /* ----- NEW - Values for emsStandardGetMailBox flags -------------------------- */
  114. #define EMSFGETMBOX_ALLOW_NEW        (1L)      /* Allow creation of new mailboxes */
  115. #define EMSFGETMBOX_ALLOW_OTHER        (2L)      /* Allow selection of "other" mailboxes */
  116.  
  117. // start MODELESS EMSAPI
  118. #define EMS_PW_WINDOWKIND    (99)
  119.  
  120. // Constants (and bitfields) for special menu commands a plugin can access
  121. // File Menu
  122. #define EMS_MENU_FILE_CLOSE            (0x0010000)
  123. #define EMS_MENU_FILE_SAVE            (0x0020000)
  124. // Edit Menu
  125. #define EMS_MENU_EDIT_UNDO            (0x0100000)
  126. #define EMS_MENU_EDIT_CUT                (0x0200000)
  127. #define EMS_MENU_EDIT_COPY            (0x0400000)
  128. #define EMS_MENU_EDIT_PASTE            (0x0800000)
  129. #define EMS_MENU_EDIT_CLEAR            (0x1000000)
  130. #define EMS_MENU_EDIT_SELECTALL    (0x2000000)
  131. // end MODELESS EMSAPI
  132.  
  133.  
  134. /* ----- Progress Data ---------------------------- */
  135. typedef struct emsProgressDataS {
  136.     long        size;        /* Size of this data structure */
  137.     long        value;        /* Range of Progress, percent complete */
  138.     StringPtr        message;    /* Progress Message */
  139. } emsProgressData;
  140.  
  141.  
  142. /* ========== POWER PC/68K GLUE FOR CALL BACKS ====================== */
  143.  
  144. /* These can be treated as magic type declarations and just passed on
  145.    to the functins below. They are the thing that Eudora passes to
  146.    the component to indicate where the call back function is.
  147.  */
  148. #if GENERATINGCFM
  149. typedef UniversalProcPtr emsProgress, emsProgressUPP;       /* Power PC */
  150. enum { emsProgressProcInfo = kPascalStackBased
  151.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  152.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsProgressData*))) };
  153. #define NewEMSProgressProc(userRoutine)        \
  154.         (emsProgressUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  155.         emsProgressProcInfo, GetCurrentArchitecture())
  156. #define CallEMSProgressProc(userRoutine, data)        \
  157.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsProgressProcInfo, (data))
  158. #else
  159. typedef pascal short (*emsProgress)(emsProgressData *); /* 68K */
  160. #define NewEMSProgressProc(userRoutine) ((emsProgressUPP) (userRoutine)))
  161. #define CallEMSProgressProc(userRoutine, data) (*(userRoutine))((data))
  162. #endif
  163.  
  164. typedef struct emsStandardGetMailBoxDataS *emsStandardGetMailBoxDataP, **emsStandardGetMailBoxDataH;
  165. #if GENERATINGCFM
  166. typedef UniversalProcPtr emsGetMailBox, emsGetMailBoxUPP;
  167. enum { emsGetMailBoxProcInfo = kPascalStackBased
  168.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsStandardGetMailBoxDataP))) };
  169. #define NewEMSGetMailBoxProc(userRoutine)        \
  170.         (emsGetMailBoxUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  171.         emsGetMailBoxProcInfo, GetCurrentArchitecture())
  172. #define CallEMSGetMailProc(userRoutine, data)        \
  173.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsGetMailBoxProcInfo, (data))
  174. #else
  175. typedef pascal void (*emsGetMailBox)(emsStandardGetMailBoxDataP getMailBoxData); 
  176. #define NewEMSGetMailBoxProc(userRoutine) ((emsGetMailBoxUPP)(userRoutine))
  177. #define CallEMSGetMailProc(userRoutine, data) (*(userRoutine))((data))
  178. #endif
  179.  
  180. typedef struct emsSetMailBoxTagDataS *emsSetMailBoxTagDataP, **emsSetMailBoxTagDataH;
  181. #if GENERATINGCFM
  182. typedef UniversalProcPtr emsSetMailBoxTag, emsSetMailBoxTagUPP;
  183. enum { emsSetMailBoxTagProcInfo = kPascalStackBased
  184.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsSetMailBoxTagDataP))) };
  185. #define NewEMSSetMailBoxTagProc(userRoutine)        \
  186.         (emsSetMailBoxTagUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  187.         emsSetMailBoxTagProcInfo, GetCurrentArchitecture())
  188. #define CallEMSSetMailBoxTagProc(userRoutine, data)        \
  189.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsSetMailBoxTagProcInfo, (data))
  190. #else
  191. typedef pascal void (*emsSetMailBoxTag)(emsSetMailBoxTagDataP setMailBoxTagData); 
  192. #define NewEMSSetMailBoxTagProc(userRoutine) ((emsSetMailBoxTagUPP)(userRoutine))
  193. #define CallEMSSetMailBoxTagProc(userRoutine, data) (*(userRoutine))((data))
  194. #endif
  195.  
  196. #if GENERATINGCFM
  197. typedef UniversalProcPtr emsGetMailBoxTag, emsGetMailBoxTagUPP;
  198. enum { emsGetMailBoxTagProcInfo = kPascalStackBased
  199.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsSetMailBoxTagDataP))) };
  200. #define NewEMSGetMailBoxTagProc(userRoutine)        \
  201.         (emsGetMailBoxTagUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  202.         emsGetMailBoxTagProcInfo, GetCurrentArchitecture())
  203. #define CallEMSGetMailBoxTagProc(userRoutine, data)        \
  204.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsGetMailBoxTagProcInfo, (data))
  205. #else
  206. typedef pascal void (*emsGetMailBoxTag)(emsSetMailBoxTagDataP setMailBoxTagData); 
  207. #define NewEMSGetMailBoxTagProc(userRoutine) ((emsGetMailBoxTagUPP)(userRoutine))
  208. #define CallEMSGetMailBoxTagProc(userRoutine, data) (*(userRoutine))((data))
  209. #endif
  210.  
  211. typedef struct emsGetPersonalityDataS *emsGetPersonalityDataP, **emsGetPersonalityDataH;
  212. #if GENERATINGCFM
  213. typedef UniversalProcPtr emsGetPersonality, emsGetPersonalityUPP;
  214. enum { uppemsGetPersonalityProcInfo = kPascalStackBased
  215.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  216.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsGetPersonalityDataP))) };
  217. #define NewEMSGetPersonalityProc(userRoutine)        \
  218.         (uppemsGetPersonalityProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  219.         emsGetPersonalityProcInfo, GetCurrentArchitecture())
  220. #define CallEMSGetPersonalityProc(userRoutine, data)        \
  221.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsGetPersonalityProcInfo, (data))
  222. #else
  223. typedef pascal short (*emsGetPersonality)(emsGetPersonalityDataP getPersonalityData);
  224. #define NewEMSGetPersonalityProc(userRoutine) ((uppemsGetPersonalityProcInfo)(userRoutine))
  225. #define CallEMSGetPersonalityProc(userRoutine, data) (*(userRoutine))((data))
  226. #endif
  227.  
  228. typedef struct emsGetPersonalityInfoDataS *emsGetPersonalityInfoDataP, **emsGetPersonalityInfoDataH;
  229. #if GENERATINGCFM
  230. typedef UniversalProcPtr emsGetPersonalityInfo, emsGetPersonalityInfoUPP;
  231. enum { uppemsGetPersonalityInfoProcInfo = kPascalStackBased
  232.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  233.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsGetPersonalityInfoDataP))) };
  234. #define NewEMSGetPersonalityInfoProc(userRoutine)        \
  235.         (uppemsGetPersonalityInfoProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  236.         emsGetPersonalityInfoProcInfo, GetCurrentArchitecture())
  237. #define CallEMSGetPersonalityInfoProc(userRoutine, data)        \
  238.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsGetPersonalityInfoProcInfo, (data))
  239. #else
  240. typedef pascal short (*emsGetPersonalityInfo)(emsGetPersonalityInfoDataP getPersonalityData);
  241. #define NewEMSGetPersonalityInfoProc(userRoutine) ((uppemsGetPersonalityInfoProcInfo)(userRoutine))
  242. #define CallEMSGetPersonalityInfoProc(userRoutine, data) (*(userRoutine))((data))
  243. #endif
  244.  
  245. typedef struct emsRegenerateDataS *emsRegenerateDataP, **emsRegenerateDataH;
  246. #if GENERATINGCFM
  247. typedef UniversalProcPtr emsRegenerate, emsRegenerateUPP;
  248. enum { uppemsRegenerateProcInfo = kPascalStackBased
  249.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsRegenerateDataP))) };
  250. #define NewEMSRegenerateProc(userRoutine)        \
  251.         (uppemsRegenerateProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  252.         emsRegenerateProcInfo, GetCurrentArchitecture())
  253. #define CallEMSRegenerateProc(userRoutine, data)        \
  254.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsRegenerateProcInfo, (data))
  255. #else
  256. typedef pascal short (*emsRegenerate)(emsRegenerateDataP RegenerateData);
  257. #define NewEMSRegenerateProc(userRoutine) ((uppemsRegenerateProcInfo)(userRoutine))
  258. #define CallEMSRegenerateProc(userRoutine, data) (*(userRoutine))((data))
  259. #endif
  260.  
  261. typedef struct emsGetDirectoryDataS *emsGetDirectoryDataP, **emsGetDirectoryDataH;
  262. #if GENERATINGCFM
  263. typedef UniversalProcPtr emsGetDirectory;
  264. enum { uppemsGetDirectoryProcInfo = kPascalStackBased
  265.         | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  266.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsGetDirectoryDataP))) };
  267. #define NewEMSGetDirectoryProc(userRoutine)        \
  268.         (uppemsGetDirectoryProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  269.         emsGetDirectoryProcInfo, GetCurrentArchitecture())
  270. #define CallEMSGetDirectoryProc(userRoutine, data)        \
  271.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsGetDirectoryProcInfo, (data))
  272. #else
  273. typedef pascal short (*emsGetDirectory)(emsGetDirectoryDataP GetDirectoryData);
  274. #define NewEMSGetDirectoryProc(userRoutine) ((uppemsGetDirectoryProcInfo)(userRoutine))
  275. #define CallEMSGetDirectoryProc(userRoutine, data) (*(userRoutine))((data))
  276. #endif
  277. typedef emsGetDirectory emsGetDirectoryUPP;
  278.  
  279. #if GENERATINGCFM
  280. typedef UniversalProcPtr emsUpdateWindows, emsUpdateWindowsUPP;
  281. enum { uppemsUpdateWindowsProcInfo = kPascalStackBased };
  282. #define NewEMSUpdateWindowsProc(userRoutine)        \
  283.         (void) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  284.         emsUpdateWindowsProcInfo, GetCurrentArchitecture())
  285. #define CallEMSUpdateWindowsProc(userRoutine)        \
  286.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsUpdateWindowsProcInfo)
  287. #else
  288. typedef pascal void (*emsUpdateWindows)(void);
  289. #define NewEMSUpdateWindowsProc(userRoutine) ((uppemsUpdateWindowsProcInfo)(userRoutine))
  290. #define CallEMSUpdateWindowsProc(userRoutine) (*(userRoutine))()
  291. #endif
  292.  
  293. // start MODELESS EMSAPI
  294. typedef struct emsPlugwindowDataS *emsPlugwindowDataP, **emsPlugwindowDataH;
  295. #if GENERATINGCFM
  296. typedef UniversalProcPtr emsPlugwindowRegister;
  297. enum { uppemsPlugwindowRegister = kPascalStackBased
  298.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsPlugwindowDataP))) };
  299. #define NewEMSPlugwindowRegisterProc(userRoutine)        \
  300.         (uppemsPlugwindowRegisterProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  301.         emsPlugwindowRegisterProcInfo, GetCurrentArchitecture())
  302. #define CallEMSPlugwindowRegisterProc(userRoutine, data)        \
  303.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsPlugwindowRegisterProcInfo, (data))
  304. #else
  305. typedef pascal short (*emsPlugwindowRegister)(emsPlugwindowDataP PlugwindowRegisterData);
  306. #define NewEMSPlugwindowRegisterProc(userRoutine) ((uppemsPlugwindowRegisterProcInfo)(userRoutine))
  307. #define CallEMSPlugwindowRegisterProc(userRoutine) (*(userRoutine))()
  308. #endif
  309. typedef emsPlugwindowRegister emsPlugwindowRegisterUPP;
  310.  
  311. #if GENERATINGCFM
  312. typedef UniversalProcPtr emsPlugwindowUnRegister;
  313. enum { uppemsPlugwindowUnRegister = kPascalStackBased
  314.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsPlugwindowDataP))) };
  315. #define NewEMSPlugwindowUnRegisterProc(userRoutine)        \
  316.         (uppemsPlugwindowUnRegisterProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  317.         emsPlugwindowUnRegisterProcInfo, GetCurrentArchitecture())
  318. #define CallEMSPlugwindowUnRegisterProc(userRoutine, data)        \
  319.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsPlugwindowUnRegisterProcInfo, (data))
  320. #else
  321. typedef pascal short (*emsPlugwindowUnRegister)(emsPlugwindowDataP PlugwindowUnRegisterData);
  322. #define NewEMSPlugwindowUnRegisterProc(userRoutine) ((uppemsPlugwindowUnRegisterProcInfo)(userRoutine))
  323. #define CallEMSPlugwindowUnRegisterProc(userRoutine) (*(userRoutine))()
  324. #endif
  325. typedef emsPlugwindowUnRegister emsPlugwindowUnRegisterUPP;
  326.  
  327. typedef struct emsGDeviceRgnDataS *emsGDeviceRgnDataP, **emsGDeviceRgnDataH;
  328. #if GENERATINGCFM
  329. typedef UniversalProcPtr emsGDeviceRgn;
  330. enum { uppemsGDeviceRgn = kPascalStackBased
  331.         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsGDeviceRgnDataP))) };
  332. #define NewEMSGDeviceRgnProc(userRoutine)        \
  333.         (uppemsGDeviceRgnProcInfo) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  334.         emsGDeviceRgnProcInfo, GetCurrentArchitecture())
  335. #define CallEMSGDeviceRgnProc(userRoutine, data)        \
  336.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppemsGDeviceRgnProcInfo, (data))
  337. #else
  338. typedef pascal short (*emsGDeviceRgn)(emsGDeviceRgnDataP GDeviceRgnData);
  339. #define NewEMSGDeviceRgnProc(userRoutine) ((uppemsGDeviceRgnProcInfo)(userRoutine))
  340. #define CallEMSGDeviceRgnProc(userRoutine) (*(userRoutine))()
  341. #endif
  342. typedef emsGDeviceRgn emsGDeviceRgnUPP;
  343. // end MODELESS EMSAPI
  344.  
  345.  
  346. /* ========== DATA STRUCTURES ============================================ */
  347. /* True Mac-style declarations aren't used yet but are included in comments. 
  348.    All strings on the Mac are PASCAL strings and all are allocated as Handles. 
  349.  */
  350. /* ----- Macintosh: MIME type data passed across the API ----------------- */
  351. /* ----- MIME Params ---------------------------- */
  352. typedef struct emsMIMEparamS *emsMIMEParamP, **emsMIMEparamH;
  353. typedef struct emsMIMEparamS {
  354.     long        size;
  355.     Str63        name;        /* MIME parameter name */
  356.     Handle        value;      /* handle size determines string length */
  357.     emsMIMEparamH       next;              /* Handle for next param in list */
  358. } emsMIMEparam;
  359. /* ----- MIME Data ----------------------------- */
  360. typedef struct emsMIMEtypeS *emsMIMEtypeP, **emsMIMEtypeH; 
  361. typedef struct emsMIMEtypeS {
  362.     long           size;
  363.     Str63              mimeVersion;     /* MIME-Version: header */
  364.     Str63              mimeType;       /* Top-level MIME type: text,message...*/
  365.     Str63              subType;         /* sub-type */
  366.     emsMIMEparamH      params;          /* Handle to first parameter in list */
  367.     Str63              contentDisp;      /* Content-Disposition */
  368.     emsMIMEparamH      contentParams;      /* Handle to first parameter in list */
  369. } emsMIMEtype;
  370. /* ----- User Address ------------------------- */
  371. typedef struct emsAddressS *emsAddressP, **emsAddressH; 
  372. typedef struct emsAddressS {
  373.     long        size;        /* Size of this data structure */
  374.     StringHandle    address;    /* Optional directory for config file */
  375.     StringHandle    realname;    /* Users full name from Eudora config */
  376.     emsAddressH        next;        /* Linked list of addresses */
  377. } emsAddress;
  378. /* ----- Header Data ---------------------------- */
  379. typedef struct emsHeaderDataS *emsHeaderDataP, **emsHeaderDataH;
  380. typedef struct emsHeaderDataS {
  381.     long        size;        /* Size of this data structure */
  382.     emsAddressH        to;        /* To Header */
  383.     emsAddressH        from;        /* From Header */
  384.     StringPtr           *subject;       /* Subject Header */
  385.     emsAddressH        cc;        /* cc Header */
  386.     emsAddressH        bcc;        /* bcc Header */
  387.     Handle        rawHeaders;    /* The 822 headers */
  388. } emsHeaderData;
  389. /* ----- NEW - structure to hold the callback functions ------------- */
  390. typedef struct emsCallBackS {
  391.     emsGetMailBox         EMSStandardGetMailBoxFunction;
  392.     emsSetMailBoxTag    EMSSetMailBoxTagFunction;
  393.     emsGetPersonality   EMSStandardGetPersonalityFunction;
  394.     emsProgress                    EMSProgressFunction;
  395.     emsRegenerate                EMSRegenerateFunction;
  396.     emsGetDirectory     EMSGetDirectoryFunction;
  397.     emsUpdateWindows        EMSUpdateWindowsFunction;
  398.     emsGetMailBoxTag    EMSGetMailBoxTagFunction;
  399.     emsGetPersonalityInfo    EMSGetPersonalityInfoFunction;
  400. // start MODELESS EMSAPI
  401.     emsPlugwindowRegister        EMSPlugwindowRegisterFunction;
  402.     emsPlugwindowUnRegister    EMSPlugwindowUnRegisterFunction;
  403.     emsGDeviceRgn    EMSGDeviceRgnFunction;
  404. // end MODELESS EMSAPI
  405. } emsCallBack;
  406.  
  407. /* ----- How Eudora is configured ------------- */
  408. typedef struct emsCallBackS *emsCallBacksP, **emsCallBacksH;
  409. typedef struct emsMailConfigS *emsMailConfigP, **emsMailConfigH; 
  410. typedef struct emsMailConfigS {
  411.     long        size;        /* Size of this data structure */
  412.     FSSpec        configDir;    /* Optional directory for config file */
  413.     emsAddress        userAddr;    /* Current users address */
  414.     emsCallBack    callBacks;    /* V4! Peanut - Pointer to callback structure */
  415. } emsMailConfig;
  416. /* ----- Plugin Info -------------------------- */
  417. typedef struct emsPluginInfoS *emsPluginInfoP, **emsPluginInfoH; 
  418. typedef struct emsPluginInfoS {
  419.     long        size;        /* Size of this data structure */
  420.     long        id;        /* Place to return unique plugin id */
  421.     long        numTrans;    /* Place to return num of translators */
  422.     long        numAttachers;    /* Place to return num of attach hooks */
  423.     long        numSpecials;    /* Place to return num of special hooks */
  424.     StringHandle    desc;        /* Return for string description of plugin */
  425.     Handle        icon;        /* Return for plugin icon data */
  426.     long        mem_rqmnt;    /* V4! Return Memory Required to run this */
  427.     long                numMBoxContext; /* V4! Peanut Place to return num of mailbox context hooks */
  428.                                         /* These are shown when the mailbox has a non-zer attribute with the plugin-s ID as key */
  429.     long                idleTimeFreq;   /* V4! Peanut Return 0 for no idle time, otherwise initial idle frequentcy in milliseconds */
  430.     long        numImporters;    /* V6! Place to return num of importer hooks */
  431. } emsPluginInfo;
  432. /* ----- Translator Info --------------------- */
  433. typedef struct emsTranslatorS *emsTranslatorP, **emsTranslatorH; 
  434. typedef struct emsTranslatorS {
  435.     long        size;        /* Size of this data structure */
  436.     long        id;        /* ID of translator to get info for */
  437.     long        type;        /* translator type, e.g., EMST_xxx */
  438.     unsigned long    flags;        /* translator flags */
  439.     StringHandle    desc;        /* translator string description */
  440.     Handle        icon;        /* translator icon data */
  441.     StringHandle    properties;    /* Properties for queued translations */
  442. } emsTranslator;
  443. /* ----- Menu Item Info --------------------- */
  444. typedef struct emsMenuS *emsMenuP, **emsMenuH; 
  445. typedef struct emsMenuS {
  446.     long        size;        /* Size of this data structure */
  447.     long        id;        /* ID of menu item to get info for */
  448.     StringHandle    desc;        /* translator string description */
  449.     Handle        icon;        /* Icon suite */
  450.     unsigned long    flags;        /* flags (EMSF_TOOLBAR_PRESENCE) */
  451. } emsMenu;
  452. /* ----- Translation Data -------------------- */
  453. typedef struct emsDataFileS *emsDataFileP, **emsDataFileH; 
  454. typedef struct emsDataFileS {
  455.     long        size;        /* Size of this data structure */
  456.     long        context;
  457.     emsMIMEtypeH    mimeInfo;    /* MIME type of data to check */
  458.     emsHeaderDataP      header;      /* EMSF_BASIC_HEADERS & EMSF_ALL_HEADERS determine contents */
  459.     FSSpec        file;        /* The input file name */
  460. } emsDataFile;
  461. /* ----- Resulting Status Data -------------- */
  462. typedef struct emsResultStatusS *emsResultStatusP, **emsResultStatusH; 
  463. typedef struct emsResultStatusS {
  464.     long        size;        /* Size of this data structure */
  465.     StringHandle    desc;        /* Returned string for display with the result */
  466.     StringHandle    error;        /* Place to return string with error message */
  467.     long        code;        /* Return for translator-specific result code */
  468. } emsResultStatus;
  469. /* ----- NEW - StandardGetMailBoxFunction Data ---------------------------- */
  470. typedef AliasHandle emsMBoxP;
  471. typedef struct emsStandardGetMailBoxDataS {
  472.     long                size;           /* IN: Size of this data structure */
  473.     long                flags;          /* IN: see flags above */
  474.     StringPtr           prompt;         /* IN: Prompt for user */
  475.     emsMBoxP            mailbox;        /* OUT: the chosen mailbox */
  476. } emsStandardGetMailBoxData;
  477. /* ----- NEW - SetMailBoxTag Data ---------------------------- */
  478. typedef struct emsSetMailBoxTagDataS{
  479.     long                size;           /* IN: Size of this data structure */
  480.     emsMBoxP            mailbox;        /* IN: the selected mailbox */
  481.     long                key;            /* IN: the attribute key (usually the plug-in's ID */
  482.     long                value;          /* IN: the attribute value, zero to clear the attribute */
  483.     long                oldvalue;       /* OUT: the attribute's old value, zero by default */
  484.     long                oldkey;           /* OUT: the attribute's old key, zero by default */
  485. } emsSetMailBoxTagData;
  486. /* ----- NEW - GetPersonality Data ---------------------------- */
  487. typedef struct emsGetPersonalityDataS{
  488.     long                size;           /* IN: Size of this data structure */
  489.     StringPtr                        prompt;                    /* IN: Prompt for user. Set to nil for standard prompt */
  490.     Boolean                            defaultPers;        /* IN: Return default personality */
  491.     short               persCount;      /* OUT: number of personalities available */
  492.     emsAddress                    personality;        /* OUT: Address info for selected personality */
  493.     StringHandle        personalityName;/* OUT: name of personality */
  494. } emsGetPersonalityData;
  495. /* ----- NEW - GetPersonalityInfo Data ---------------------------- */
  496. typedef struct emsGetPersonalityInfoDataS{
  497.     long                size;           /* IN: Size of this data structure */
  498.     StringHandle        personalityName;/* IN: name of personality */
  499.     emsAddress          personality;    /* OUT: Address info for selected personality */
  500. } emsGetPersonalityInfoData;
  501. /* ----- NEW - Regenerate Data ---------------------------- */
  502. typedef enum { emsRegenerateFilters,emsRegenerateNicknames } RegenerateType;
  503. typedef struct emsRegenerateDataS{
  504.     long                size;           /* IN: Size of this data structure */
  505.     RegenerateType            which;                    /* IN: What should Eudora regenerate? */
  506. } emsRegenerateData;
  507. /* ----- NEW - Get Directory Data ---------------------------- */
  508. typedef enum { EMS_EudoraDir,                    /* Eudora folder, contains all other folders */
  509.                         EMS_AttachmentsDir,                /* Attachments folder */
  510.                         EMS_PluginFiltersDir,            /* Filters folder for plug-ins */
  511.                         EMS_PluginNicknamesDir,        /* Nicknames folder for plug-ins */
  512.                         EMS_ConfigDir,                        /* Folder for plug-ins' preferences */
  513.                         EMS_MailDir,                            /* Folder containing mailboxes */
  514.                         EMS_NicknamesDir,                    /* Eudora nicknames folder */
  515.                         EMS_SignaturesDir,                /* Signatures folder */
  516.                         EMS_SpoolDir,                            /* Spool folder */
  517.                         EMS_StationeryDir                    /* Stationery folder */
  518.                     } DirectoryEnum;
  519. typedef struct emsGetDirectoryDataS{
  520.     long                size;           /* IN: Size of this data structure */
  521.     DirectoryEnum            which;                    /* IN: Which directory? */
  522.     FSSpec                            directory;            /* OUT: FileSpec for directory */
  523. } emsGetDirectoryData;
  524. /* ----- NEW - Idle Data ---------------------------- */
  525. typedef struct emsIdleDataS{
  526.     long                                flags;                    /* IN: flags */
  527.     long                                *idleTimeFreq;    /* IN,OUT: requested idle time */
  528.     emsProgress                    progress;                /* IN: Callback function to report progress/check for abort */
  529. } emsIdleData, *emsIdleDataP;
  530.  
  531. // start MODELESS EMSAPI
  532. typedef struct emsPlugwindowDataS {
  533.     long    size;                /* IN: Size of this data structure */
  534.     void*    nativeWindow;    /* reference to WindowPtr or HWND */
  535.     long    plugwindowID;    /* local id assigned by plug-in */
  536.     unsigned long menuMask;    /* Mask for menu items to be used */
  537.     long    top;        /* For saving size and position */
  538.     long    left;        /* not used by plug-in except for reopen() */
  539.     long    bottom;
  540.     long    right;
  541.     long    plugin_refcon;    /* for plug-in's use, NEVER used by Eudora */
  542.     long    pluginID;    // id of the plug-in
  543. } emsPlugwindowData;
  544.  
  545. typedef struct emsPlugwindowEventS {
  546.     long    size;                /* IN: Size of this data structure */
  547.     void*    nativeEvent;    /* reference to EventRecord on Mac */
  548. } emsPlugwindowEvent, *emsPlugwindowEventP;
  549.  
  550. typedef struct emsPlugwindowMenuDataS {
  551.     long    size;                /* IN: Size of this data structure */
  552.     unsigned long menuMask;    /* Mask for menu item */
  553. } emsMenuData, *emsPlugwindowMenuDataP;
  554.  
  555. typedef struct emsPlugwindowDragDataS {
  556.     long    size;                /* IN: Size of this data structure */
  557.     DragTrackingMessage message;    // message of 0xfff means "drop"
  558.     DragReference drag;    /* drag data */
  559. } emsPlugwindowDragData, *emsPlugwindowDragDataP;
  560.  
  561. typedef struct emsGDeviceRgnDataS {
  562.     long    size;                /* IN: Size of this data structure */
  563.     short gdIndex;            /* IN: index of device you want to know about */
  564.     RgnHandle usableRgn;    /* usable region of the screen */
  565.     Rect largestRectangle;    /* largest rect available on the screen */
  566. } emsGDeviceRgnData;
  567. // end MODELESS EMSAPI
  568.  
  569. /* ========== FUNCTION PROTOTYPES ======================================== */
  570.  
  571. /* ----- Get the API Version number this plugin implements ----------------- */
  572. pascal long ems_plugin_version(
  573.     Handle globals,              /* Out: Return for allocated instance structure */
  574.     short *apiVersion            /* Out: Plugin Version */
  575. );
  576.  
  577. /* ----- Initialize plugin and get its basic info -------------------------- */
  578. pascal long ems_plugin_init(
  579.     Handle globals,              /* Out: Return for allocated instance structure */
  580.     short eudAPIVersion,         /* In: The API version eudora is using */
  581.     emsMailConfigP mailConfig,   /* In: Eudoras mail configuration */
  582.     emsPluginInfoP pluginInfo    /* Out: Return Plugin Information */
  583. );
  584.  
  585. /* ----- Get details about a translator in a plugin ------------------------ */
  586. pascal long ems_translator_info(
  587.     Handle globals,              /* Out: Return for allocated instance structure */
  588.     emsTranslatorP transInfo     /* In/Out: Return Translator Information */
  589. );
  590.  
  591. /* ----- Check and see if a translation can be performed ------------------- */
  592. pascal long ems_can_translate(
  593.     Handle globals,              /* Out: Return for allocated instance structure */
  594.     emsTranslatorP trans,        /* In: Translator Info */
  595.     emsDataFileP inTransData,    /* In: What to translate */
  596.     emsResultStatusP transStatus /* Out: Translations Status information */
  597. );
  598.  
  599. /* ----- Actually perform a translation on a file -------------------------- */
  600. pascal long ems_translate_file(
  601.     Handle globals,              /* Out: Return for allocated instance structure */
  602.     emsTranslatorP trans,        /* In: Translator Info */
  603.     emsDataFileP inFile,         /* In: What to translate */
  604.     emsProgress progress,        /* Func to report progress/check for abort */
  605.     emsDataFileP outFile,        /* Out: Result of the translation */
  606.     emsResultStatusP transStatus /* Out: Translations Status information */
  607. );
  608.  
  609. /* ----- End use of a plugin and clean up ---------------------------------- */
  610. pascal long ems_plugin_finish(
  611.     Handle globals               /* Out: Return for allocated instance structure */
  612. );
  613.  
  614. /* ----- Call the plug-ins configuration Interface ------------------------- */
  615. pascal long ems_plugin_config(
  616.     Handle globals,              /* Out: Return for allocated instance structure */
  617.     emsMailConfigP mailConfig    /* In: Eudora mail info */
  618. );
  619.  
  620. /* ----- Manage properties for queued translations ------------------------- */
  621. pascal long ems_queued_properties(
  622.     Handle globals,              /* Out: Return for allocated instance structure */
  623.     emsTranslatorP trans,        /* In/Out: The translator */
  624.     long *selected               /* In/Out: State of this translator */
  625. );
  626.  
  627. /* ----- Info about menu hook to attach/insert composed object ------------- */
  628. pascal long ems_attacher_info(
  629.     Handle globals,              /* Out: Return for allocated instance structure */
  630.     emsMenuP attachMenu          /* Out: The menu */
  631. );
  632.  
  633. /* ----- Call an attacher hook to compose some special object -------------- */
  634. pascal long ems_attacher_hook(
  635.     Handle globals,              /* Out: Return for allocated instance structure */
  636.     emsMenuP attachMenu,         /* In: The menu */
  637.     FSSpec *attachDir,           /* In: Location to put attachments */
  638.     long *numAttach,             /* Out: Number of files attached */
  639.     emsDataFileH *attachFiles    /* Out: Name of files written */
  640. );
  641.  
  642. /* ----- Info about special menu items hooks ------------------------------- */
  643. pascal long ems_special_info(
  644.     Handle globals,              /* Out: Return for allocated instance structure */
  645.     emsMenuP specialMenu         /* Out: The menu */
  646. );
  647.  
  648. /* ----- Call a special menu item hook ------------------------------------- */
  649. pascal long ems_special_hook(
  650.     Handle globals,              /* Out: Return for allocated instance structure */
  651.     emsMenuP specialMenu         /* In: The menu */
  652. );
  653.  
  654. /* -----   Idle handline ------------------------------------- */
  655. pascal long ems_idle(
  656.     Handle globals,             /* Out: Return for allocated instance structure */
  657.         emsIdleDataP    idleData            /* In:  data */
  658. );
  659.  
  660. /* -----  Get context menu  ------------------------------------- */
  661. pascal long ems_mbox_context_info(
  662.     Handle globals, 
  663.     emsMenuP mbox_context_Menu
  664. );
  665.  
  666. /* ----- Handle context menu hit  ------------------------------------- */
  667. pascal long ems_mbox_context_hook(
  668.     Handle globals,
  669.     emsMBoxP mailbox,
  670.     emsMenuP mbox_context_Menu
  671. );
  672.  
  673. // start MODELESS EMSAPI
  674. pascal long ems_plugwindow_close(
  675.         Handle globals,
  676.         emsPlugwindowDataP data
  677. );
  678.  
  679. pascal void ems_plugwindow_reopen(
  680.         Handle globals,
  681.         emsPlugwindowDataP data
  682. );
  683.  
  684. pascal long ems_plugwindow_event(
  685.         Handle globals,
  686.         emsPlugwindowDataP data,
  687.         emsPlugwindowEventP event
  688. );
  689.  
  690. pascal void ems_plugwindow_menu_enable(
  691.         Handle globals,
  692.         emsPlugwindowDataP data,
  693.         emsPlugwindowMenuDataP menuData
  694. );
  695.  
  696. pascal long ems_plugwindow_menu(
  697.         Handle globals,
  698.         emsPlugwindowDataP data,
  699.         emsPlugwindowMenuDataP menuData
  700. );
  701. pascal void ems_plugwindow_drag(
  702.         Handle globals,
  703.         emsPlugwindowDataP data,
  704.         emsPlugwindowDragDataP dragData
  705. );
  706. // end MODELESS EMSAPI
  707.  
  708.  
  709. /* ======================================================================= */
  710. /* ========== EMSAPI Importer Plugin Data ================================ */
  711. /* ======================================================================= */
  712.  
  713.  
  714. /* ========== POWER PC/68K GLUE FOR CALL BACKS =========================== */
  715.  
  716.  
  717. /* ---------- Make Sig data ---------------------------------------------- */
  718. typedef struct emsMakeSigDataS {
  719.     long            size;        /* Size of this data structure */
  720.     StringPtr         name;        /* the name of the signature file */
  721.        Handle             sigText;    /* The text of the signature */
  722. } emsMakeSigData;
  723.  
  724. /* ---------- Make Address Book data ------------------------------------- */
  725. typedef struct emsMakeAddressBookDataS 
  726. {
  727.     long    size;                /* Size of this data structure */
  728.     StringPtr name;                /* the name of the address book file */
  729. } emsMakeAddressBookData;
  730.  
  731. /* ---------- Make Address Book Entry data ------------------------------ */
  732. typedef struct emsMakeABEntryDataS 
  733. {
  734.     long    size;                /* Size of this data structure */
  735.     short which;                /* where to put the address book entry */
  736.     Boolean isGroup;            /* is this a group? */
  737.     StringPtr nickName;            /* The name of the address book entry */
  738.     Handle addresses;            /* the addresses */
  739.      Handle notes;                /* the notes */
  740. } emsMakeABEntryData;
  741.  
  742. /* ---------- Make Mailbox Data ---------------------------------------- */
  743. typedef enum 
  744.     EMS_IMPORT_MAILBOX_Start,
  745.     EMS_IMPORT_MAILBOX_Create_Mailbox,
  746.     EMS_IMPORT_MAILBOX_Flush_Mailbox,
  747.     EMS_IMPORT_MAILBOX_Done
  748. } ImportMailboxOperationEnum;
  749. typedef struct emsMakeMailboxDataS 
  750. {
  751.     long    size;                        /* Size of this data structure */
  752.     ImportMailboxOperationEnum command;    /* IN: what to do */
  753.     FSSpec boxSpec;                        /* IN/OUT: the mailbox to create */
  754.     Boolean isFolder;                    /* IN: is this mailbox a folder? */
  755.     Boolean noSelect;                    /* IN: is this mailbox a simple folder? */
  756. } emsMakeMailboxData;
  757.  
  758. /* ---------- Make Out Message Data ------------------------------------ */
  759. typedef struct emsMakeOutMessDataS
  760. {
  761.     long    size;                /* Size of this data structure */
  762.     StringPtr fromAddress;        // from address
  763.     Handle toAddresses;            // addresses in the To: field
  764.     Handle ccAddresses;            // addresses in the Cc: field
  765.     Handle bccAddresses;        // addresses in the Bcc: field
  766.     StringPtr subject;            // 255 characters of the subject
  767.     Handle text;                // the text of the message
  768.     short numAttachments;        // the total number of attachments
  769.     Handle attachSpecs;            // the attachments
  770.     long inBoxNumber;            // the mailbox the message is in
  771.     FSSpec boxSpec;                // FSSpec of the mailbox
  772.     Boolean isSent;                // Is this message a sent message?
  773.     long date;                    // the date this message was sent
  774. } emsMakeOutMessData;
  775.  
  776. /* ---------- Make Message From Mime Data ----------------------------- */
  777. typedef struct emsMakeMessageDataS
  778. {
  779.     long    size;                /* Size of this data structure */
  780.     short     ref;                /* where the data is coming from */
  781.     long    offset;                /* offset into the file where the message can be found */
  782.     long     len;                /* length of the message to be read */
  783.     short    state;                /* the message state the plugin believes to see */
  784.     FSSpec    boxSpec;            /* where the message should end up */
  785.     Handle     attachments;        /* the attachments to be stuck into this message */
  786. } emsMakeMessageData;
  787.  
  788. #if GENERATINGCFM
  789. typedef UniversalProcPtr emsMakeSig, emsMakeSigUPP;       /* Power PC */
  790. enum { emsMakeSigProcInfo = kPascalStackBased
  791.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  792.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeSigData *))) };
  793. #define NewEMSMakeSigProc(userRoutine)        \
  794.         (emsMakeSigUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  795.         emsMakeSigProcInfo, GetCurrentArchitecture())
  796. #define CallEMSMakeSigProc(userRoutine, data)        \
  797.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeSigProcInfo, (data))
  798. #else
  799. typedef pascal short (*emsMakeSig)(emsMakeSigData *); /* 68K */
  800. #define NewEMSMakeSigProc(userRoutine) ((emsMakeSigUPP) (userRoutine)))
  801. #define CallEMSMakeSigProc(userRoutine, data) (*(userRoutine))((data))
  802. #endif
  803.  
  804. #if GENERATINGCFM
  805. typedef UniversalProcPtr emsMakeAddressBook, emsMakeAddressBookUPP;       /* Power PC */
  806. enum { emsMakeAddressBookProcInfo = kPascalStackBased
  807.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  808.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeAddressBookData *))) };
  809. #define NewEMSMakeAddressBookProc(userRoutine)        \
  810.         (emsMakeAddressBookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  811.         emsMakeAddressBookProcInfo, GetCurrentArchitecture())
  812. #define CallEMSMakeAddressBookProc(userRoutine, data)        \
  813.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeAddressBookProcInfo, (data))
  814. #else
  815. typedef pascal short (*emsMakeAddressBook)(emsMakeAddressBookData *); /* 68K */
  816. #define NewEMSMakeAddressBookProc(userRoutine) ((emsMakeAddressBookUPP) (userRoutine)))
  817. #define CallEMSMakeAddressBookProc(userRoutine, data) (*(userRoutine))((data))
  818. #endif
  819.  
  820. #if GENERATINGCFM
  821. typedef UniversalProcPtr emsMakeABEntry, emsMakeABEntryUPP;       /* Power PC */
  822. enum { emsMakeABEntryProcInfo = kPascalStackBased
  823.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  824.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeABEntryData *))) };
  825. #define NewEMSMakeABEntryProc(userRoutine)        \
  826.         (emsMakeABEntryUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  827.         emsMakeABEntryProcInfo, GetCurrentArchitecture())
  828. #define CallEMSMakeABEntryProc(userRoutine, data)        \
  829.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeABEntryProcInfo, (data))
  830. #else
  831. typedef pascal short (*emsMakeABEntry)(emsMakeABEntryData *); /* 68K */
  832. #define NewEMSMakeABEntryProc(userRoutine) ((emsMakeABEntryUPP) (userRoutine)))
  833. #define CallEMSMakeABEntryProc(userRoutine, data) (*(userRoutine))((data))
  834. #endif
  835.  
  836. #if GENERATINGCFM
  837. typedef UniversalProcPtr emsMakeMailbox, emsMakeMailboxUPP;       /* Power PC */
  838. enum { emsMakeMailboxProcInfo = kPascalStackBased
  839.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  840.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeMailboxData *))) };
  841. #define NewEMSMakeMailboxProc(userRoutine)        \
  842.         (emsMakeMailboxUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  843.         emsMakeMailboxProcInfo, GetCurrentArchitecture())
  844. #define CallEMSMakeMailboxProc(userRoutine, data)        \
  845.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeMailboxProcInfo, (data))
  846. #else
  847. typedef pascal short (*emsMakeMailbox)(emsMakeMailboxData *); /* 68K */
  848. #define NewEMSMakeMailboxProc(userRoutine) ((emsMakeMailboxUPP) (userRoutine)))
  849. #define CallEMSMakeMailboxProc(userRoutine, data) (*(userRoutine))((data))
  850. #endif
  851.  
  852. typedef struct emsMakeOutMessDataS *emsMakeOutMessDataP, **emsMakeOutMessDataH;
  853. #if GENERATINGCFM
  854. typedef UniversalProcPtr emsMakeOutMess, emsMakeOutMessUPP;       /* Power PC */
  855. enum { emsMakeOutMessProcInfo = kPascalStackBased
  856.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  857.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeOutMessData *))) };
  858. #define NewEMSMakeOutMessProc(userRoutine)        \
  859.         (emsMakeOutMessUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  860.         emsMakeOutMessProcInfo, GetCurrentArchitecture())
  861. #define CallEMSMakeOutMessProc(userRoutine, data)        \
  862.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeOutMessProcInfo, (data))
  863. #else
  864. typedef pascal short (*emsMakeOutMess)(emsMakeOutMessData *); /* 68K */
  865. #define NewEMSMakeOutMessProc(userRoutine) ((emsMakeOutMessUPP) (userRoutine)))
  866. #define CallEMSMakeOutMessProc(userRoutine, data) (*(userRoutine))((data))
  867. #endif
  868.  
  869. typedef struct emsMakeMessageDataS *emsMakeMessageDataP, **emsMakeMessageDataH;
  870. #if GENERATINGCFM
  871. typedef UniversalProcPtr emsMakeMessage, emsMakeMessageUPP;       /* Power PC */
  872. enum { emsMakeMessageProcInfo = kPascalStackBased
  873.             | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  874.             | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(emsMakeMessageData *))) };
  875. #define NewEMSMakeMessageProc(userRoutine)        \
  876.         (emsMakeMessageUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), \
  877.         emsMakeMessageProcInfo, GetCurrentArchitecture())
  878. #define CallEMSMakeMessageProc(userRoutine, data)        \
  879.         CallUniversalProc((UniversalProcPtr)(userRoutine), emsMakeMessageProcInfo, (data))
  880. #else
  881. typedef pascal short (*emsMakeMessage)(emsMakeMessageData *); /* 68K */
  882. #define NewEMSMakeMessageProc(userRoutine) ((emsMakeMessageUPP) (userRoutine)))
  883. #define CallEMSMakeMessageProc(userRoutine, data) (*(userRoutine))((data))
  884. #endif
  885.  
  886.  
  887.  
  888. /* ========== IMPORTER DATA STRUCTURES =================================== */
  889.  
  890.  
  891. /* ----------  Importer Plugin Information ------------------------------- */
  892. typedef struct emsImporterS *emsImporterP, **emsImporterH; 
  893. typedef struct emsImporterS {
  894.     long        size;        /* Size of this data structure */
  895.     long        id;        /* ID of translator to get info for */
  896.     long        type;        /* translator type, e.g., EMST_xxx */
  897.     unsigned long    flags;        /* translator flags */
  898.     StringHandle    desc;        /* translator string description */
  899.     Handle        icon;        /* translator icon data */
  900. } emsImporter;
  901.  
  902. /* ---------- Importer Data --------------------------------------------- */
  903. typedef enum 
  904.     EMS_IMPORT_Name_Query,
  905.     EMS_IMPORT_Query,
  906.     EMS_IMPORT_Settings,
  907.     EMS_IMPORT_Signatures,
  908.     EMS_IMPORT_Addresses,
  909.     EMS_IMPORT_Mail
  910. } ImportOperationEnum;
  911. typedef struct emsImporterDataS *emsImporterDataP, **emsImporterDataH; 
  912. typedef struct emsImporterDataS {
  913.     long size;                    /* Size of this data structure */
  914.     ImportOperationEnum what;    /* import operation selector */
  915.     void *params;                /* parameters for the operation */
  916.        void *results;                /* results of the opertaion */
  917. } emsImporteData;
  918.  
  919. /* structure describing where an importable data store is */
  920. typedef struct ImportAccountInfoS ImportAccountInfoS, *ImportAccountInfoP, **ImportAccountInfoH;
  921. typedef struct ImportAccountInfoS
  922. {
  923.     long    size;                            /* IN: Size of this data structure */
  924.     FSSpec importSpec;                        /* spec pointing to folder or file to import */
  925.     Str63 accountName;                        /* name of account */
  926.     Str63 appName;                            /* name of Application */
  927.     Handle icon;                            /* Application icon data */
  928.     long id;                                /* The importer that will actually do the work */
  929. } ImportAcountInfo;
  930.  
  931. /* Structure to hold all information about an imported personality */
  932. typedef struct ImportPersDataS *ImportPersDataP, **ImportPersDataH;
  933. typedef struct ImportPersDataS
  934. {
  935.     long size;                    /* IN: Size of this data structure */
  936.     long makeDominant;        /* Is this the main account? */
  937.     Str255 accountName;            /* The name of the personality to be created */
  938.     Str255 returnAddress;        /* return address */
  939.     Str255 realName;            /* real name */
  940.     Str255 userName;            /* username */
  941.     Str255 mailServer;            /* mail server */
  942.     Str255 smtpServer;            /* smtp server */
  943.     Boolean isIMAP;                /* is this an IMAP account? */
  944. } ImportPersData;
  945.  
  946. /* Structure to pass all the information needed to import signatures */
  947. typedef struct ImportSignaturesDataS ImportSignaturesDataS, *ImportSignaturesDataP, **ImportSignaturesDataH;
  948. typedef struct ImportSignaturesDataS
  949. {
  950.     long    size;                /* IN: Size of this data structure */
  951.     FSSpec    importSpec;            /* Spec pointing to the folder or file to import */
  952.     emsMakeSig makeSig;            /* Callback to actually create the signature file */
  953.     emsProgress progress;        /* Callback for progress */
  954. } ImportSignaturesData;
  955.  
  956. /* Structure to pass all the information needed to import addresses */
  957. typedef struct ImportAddressDataS ImportAddressDataS, *ImportAddressDataP, **ImportAddressDataH;
  958. typedef struct ImportAddressDataS
  959. {
  960.     long    size;                            /* IN: Size of this data structure */
  961.     FSSpec    importSpec;                        /* Spec pointing to the folder or file to import */
  962.     Str63    accountName;                    /* name of the account */
  963.     emsMakeAddressBook makeAddressBook;        /* Callback to create an address book file */
  964.     emsMakeABEntry makeABEntry;        /* Callback to create an address book entry */
  965.     emsProgress progress;                    /* Callback for progress */
  966. } ImportAddressData;
  967.  
  968. /* Structure to pass all the information needed to import messages and mailboxes */
  969. typedef struct ImportMailDataS ImportMailDataS, *ImportMailDataP, **ImportMailDataH;
  970. typedef struct ImportMailDataS
  971. {
  972.     long    size;                            /* IN: Size of this data structure */
  973.     FSSpec    importSpec;                        /* Spec pointing to the folder or file to import */
  974.     Str63    accountName;                    /* name of the account */
  975.     emsMakeMailbox makeMailbox;                /* Callback to create a mailbox */
  976.     emsMakeOutMess makeOutMess;                /* Callback to create an outgoing message */
  977.     emsMakeMessage makeMessage;                /* Callback to read MIME encoded messages */
  978.     emsProgress progress;                    /* Callback for progress */
  979. } ImportMailData;
  980.  
  981.  
  982.  
  983. /* ========== Importer FUNCTION PROTOTYPES =============================== */
  984.  
  985.  
  986. /* ---------- Get details about an importer in a plugin ------------------ */
  987. pascal long ems_importer_info(
  988.     Handle globals,               /* Out: Return for allocated instance structure */
  989.     emsImporterP importerInfo     /* In/Out: Return Importer Information */
  990. );
  991.  
  992. /* ---------- Call an importer hook -------------------------------------- */
  993. pascal long ems_importer_hook(
  994.     Handle globals,                  /* Out: Return for allocated instance structure */
  995.     emsImporterDataP importerData   /* In/Out: Return Importer Data */
  996. );
  997.  
  998.  
  999. #endif /* EMSAPI_MAC_H_INCLUDED */
  1000.  
  1001.